package com.stateflow.engine.user.web;

import com.stateflow.facade.common.model.res.CommonResult;
import com.stateflow.engine.user.biz.dto.req.CreateUserReqDTO;
import com.stateflow.engine.user.biz.dto.req.LoginReqDTO;
import com.stateflow.engine.user.biz.service.UserInfoService;
import com.stateflow.facade.common.util.CreateRequestUtils;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * Created by weiqingming on 2019/12/6.
 * 用户信息
 */
@RestController
@RequestMapping(value = "/user/")
public class UserInfoController {

    @Resource
    private UserInfoService userInfoService;

    @RequestMapping(value = "createUser.json",method = RequestMethod.POST)
    @ResponseBody
    public CommonResult createUser(@RequestBody CreateUserReqDTO param){
        return userInfoService.createUser(CreateRequestUtils.createByInside(param));
    }

    @RequestMapping(value = "login.json",method = RequestMethod.POST)
    @ResponseBody
    public CommonResult login(@RequestBody LoginReqDTO param){
        return userInfoService.login(CreateRequestUtils.createByInside(param));
    }

}
